package com.yihaodian.index.meta.routing;

import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class RoutingGenerator {

	
	private static RoutingGenerator instance;
	
	public synchronized static RoutingGenerator getInstance() {
		if(instance == null) {
			instance = new RoutingGenerator();
		}
		return instance;
	}
	
	private RoutingGenerator() {
	
	}
	
	
	/**
	 * Generate placement plan incrementally
	 * 
	 * Not thread-safe, caller must hold lock of index and cluster.
	 * 
	 * @param index : index with shards (optionally with assigned replicas)  
	 * @param cluster : node cluster 
	 * @param prevDeployment: generate new placement plan based on old one, 
	 * 						minimize re-deploying efforts as possible 
	 * @return IndexDeployment
	 */
	public RoutingTable genPlan(String indexId, String clusterId, RoutingTable prevDeployment) {
		return null;
	}
	
	/**
	 * Deploy index to nodes
	 * 
	 * Not thread-safe, caller must hold lock of index and cluster.
	 *  
	 */
	public void deploy(RoutingTable deployment) {
	}
	

}
